﻿namespace MsForgeReboot.Web.Controllers {
    #region Usings

    using System;
    using System.Web.Mvc;

    using MsForgeReboot.Framework.Interfaces;

    #endregion

    public class SpeakersController : Controller {
        private readonly ISpeakerService speakerService;

        /// <summary>
        /// Initializes a new instance of the <see cref="SpeakersController" /> class.
        /// </summary>
        /// <param name="speakerService">The speaker service.</param>
        public SpeakersController(ISpeakerService speakerService) {
            this.speakerService = speakerService;
        }

        /// <summary>
        /// Indexes the specified page.
        /// </summary>
        /// <param name="page">The page.</param>
        /// <param name="pageSize">Size of the page.</param>
        /// <returns>Paged list of registred Speakers</returns>
        public ActionResult Index(int page = 1, int pageSize = 10) {
            this.ViewBag.Title = "Predavački biro";
            return this.View(this.speakerService.GetList(page, pageSize));
        }

        [HttpGet]
        public ActionResult View(string urlPointer) {
            return this.View(this.speakerService.GetByUrlPointer(urlPointer));
        }
    }
}
